#include "pch.h"
using namespace std;
using namespace chrono;

const std::string getCurrentSystemTime()
{
	auto tt = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
	tm ptm;
	localtime_s(&ptm, &tt);
	char date[60] = { 0 };

	sprintf_s(date, "%d/%02d/%02d %02d:%02d:%02d:%02d",
		(int)ptm.tm_year + 1900, (int)ptm.tm_mon + 1, (int)ptm.tm_mday,
		(int)ptm.tm_hour, (int)ptm.tm_min, (int)ptm.tm_sec,(int)ptm.tm_wday);
	return std::string(date);

}
void mm()
{
	using namespace std::chrono;
	auto now = system_clock::now();
	time_t t = system_clock::to_time_t(now);
	std::tm tm;
	localtime_s(&tm, &t);

	//std::tm tm = *std::localtime(&t);
	//auto time = std::put_time(&tm, "%b %d %Y %H:%M:%S");
	/*using namespace std::chrono;
	auto now = system_clock::now();
	time_t t = system_clock::to_time_t(now);
	std::tm tm = *std::localtime(&t);
	auto time = std::put_time(&tm, "%b %d %Y %H:%M:%S");*/
}


int mains()
{
	cout << getCurrentSystemTime().c_str() << endl;
	auto start = system_clock::now();
	// do something...
	auto end = system_clock::now();
	auto duration = duration_cast<microseconds>(end - start);
	cout << duration.count() << endl;
	auto duraM = duration_cast<seconds>(end - start);
	cout << duraM.count() << endl;
	//auto yy = duration_cast<year>(end - start);
	//cout << yy<<endl;
	std::tm tmObj;

	getchar();
	return 0;
}